<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no" />
		<title>速翔网络 - QQ技术：1424445608</title>
		<link rel="stylesheet" type="text/css" href="../c/aui.css" />
		<link rel="stylesheet" type="text/css" href="../c/animate.css" />
		<style>
      html,body {
        background-color: transparent !important;
      }
			.t{
				position: fixed;
				z-index: 99999;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				z-index: 0;
				/*background-color: rgba(0, 0, 0, 0.5)*/

			}
			.sx-fenxiang-info{
				position: fixed;
				bottom: 0;
				left: 0;
				width: 100%;
				z-index: 1;

			}
			.sx-fenxiang-info .aui-ellipsis-1 {
				text-align: center;
			}
			.slide {
				background: none;
				overflow: hidden;
				overflow-x: scroll;
				-webkit-overflow-scrolling: touch;
				display: -webkit-box;
				white-space: nowrap;
				padding: 0.75rem;
				padding-bottom: 1rem;
				position: relative;
        background:#1E1C20;
			}
			.slide .swiper-slide {
				padding-right: 1.2rem;
        width: 4rem;
			}
			.swiper-slide img {
				width: 2.5rem;
				margin: 0 auto;
				padding-bottom: 0.3rem;
			}
			.slide .swiper-slide p {
				font-size: 0.6rem;
			}
			.dels{
				text-align: center;
				font-size: 0.85rem;
				color: #fff;
				/*padding: 1rem 0;*/
				background: #2B292B;
			}
			.dels span{
				padding: 1rem 0;
				display: block;
			}
			.asdasd{
				border-top-left-radius:0.5rem;
				border-top-right-radius:0.5rem;
				border-bottom: 0.05rem solid #2B292B;
				padding-top: 1rem;

			}
			.xiamian,.xiamian div{

			}
      .xiamian img{
        opacity: 0.7
      }
			.asdasd .swiper-slide{
				/*opacity: 0;*/
			}
			.bounceInUp{
				animation-duration: 0.8s;
				animation-fill-mode: both;
			}
			/*.fadeInUp1{
				animation-delay:0.3s;
			}
			.fadeInUp2{
				animation-delay:0.4s;
			}
			.fadeInUp3{
				animation-delay:0.5s;
			}
			.fadeInUp4{
				animation-delay:0.6s;
			}
			.fadeInUp5{
				animation-delay:0.7s;
			}
			.fadeInUp6{
				animation-delay:0.8s;
			}
			.fadeInUp7{
				animation-delay:0.7s;
			}*/
			.fadeInUp1{
				/*animation-delay:0.3s;*/
			}
			.fadeInUp2{
				animation-delay:0.1s;
			}
			.fadeInUp3{
				animation-delay:0.15s;
			}
			.fadeInUp4{
				animation-delay:0.2s;
			}
			.fadeInUp5{
				animation-delay:0.25s;
			}
			.fadeInUp6{
				animation-delay:0.3s;
			}
			.fadeInUp7{
				animation-delay:0.35s;
			}
			.fadeInUp8{
				animation-delay:0.4s;
			}
			.fadeInUp9{
				animation-delay:0.45s;
			}
			.fadeInUp10{
				animation-delay:0.5s;
			}
		</style>
	</head>
	<body>
		<div class="t" tapmode onclick="c()"></div>
		<div class="sx-fenxiang-info">
			<div id="ad"></div>
			<div class="slide asdasd">
				<div class="swiper-slide fadeInUp1  bounceInUp"  tapmode onclick="_weixin('session')">
					<img src="../i/share/session.png" />
					<p class="aui-ellipsis-1">
						微信
					</p>
				</div>
				<div class="swiper-slide fadeInUp2  bounceInUp" tapmode onclick="_weixin('timeline')">
					<img src="../i/share/timeline.png" />
					<p class="aui-ellipsis-1">
						朋友圈
					</p>
				</div>
        <div class="swiper-slide fadeInUp3  bounceInUp" tapmode onclick="_qq('QFriend')">
					<img src="../i/share/QFriend.png" />
					<p class="aui-ellipsis-1">
						QQ
					</p>
				</div>
				<div class="swiper-slide fadeInUp4  bounceInUp" tapmode onclick="_qq('QZone')">
					<img src="../i/share/QZone.png" />
					<p class="aui-ellipsis-1">
						QQ空间
					</p>
				</div>
        <div class="swiper-slide fadeInUp5  bounceInUp" tapmode onclick="_weibo()">
					<img src="../i/share/weibo.png" />
					<p class="aui-ellipsis-1">
						微博
					</p>
				</div>

				<div class="swiper-slide fadeInUp6  bounceInUp" tapmode onclick="sharedModule()">
					<img src="../i/share/shared.png" />
					<p class="aui-ellipsis-1">
						更多分享
					</p>
				</div>

			</div>

			<div class="slide xiamian" >
			 
				<div class="swiper-slide shoucang fadeInUp1 bounceInUp" data-id="1"  tapmode onclick="shoucang()">
					<img src="../i/share/shoucang.png"/>
					<p class="aui-ellipsis-1">
						收藏
					</p>
				</div>
				<div class="swiper-slide baocun fadeInUp2 bounceInUp" tapmode onclick="baocun()">
					<img src="../i/share/xiazai.png" />
					<p class="aui-ellipsis-1">
						保存视频
					</p>
				</div>
        <div class="swiper-slide fadeInUp3 bounceInUp" tapmode onclick="fuzhi()">
					<img src="../i/share/url.png" />
					<p class="aui-ellipsis-1">
						复制链接
					</p>
				</div>
				<div class="swiper-slide jubao fadeInUp4 bounceInUp" tapmode onclick="jubao()">
					<img src="../i/share/jubao.png" />
					<p class="aui-ellipsis-1">
						举报
					</p>
				</div>
				<div class="swiper-slide yinbi aui-hide" tapmode onclick="yinbi()">
					<img src="../i/share/jubao.png" />
					<p class="aui-ellipsis-1">
						隐蔽
					</p>
				</div>
				<div class="swiper-slide lahei aui-hide" tapmode onclick="lahei()">
					<img src="../i/share/jubao.png" />
					<p class="aui-ellipsis-1">
						拉黑
					</p>
				</div>
				<div class="swiper-slide del aui-hide fadeInUp5 fadeInUp" tapmode onclick="del()">
					<img src="../i/share/del.png" />
					<p class="aui-ellipsis-1">
						删除
					</p>
				</div>
			</div>
			<div class="dels" tapmode onclick="c()">
				<span>取消</span>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../j/api.js"></script>
	<script type="text/javascript">
		var a,_name,_frameName=''
// animated fadeInUp
		// var slide_this = $('.asdasd .swiper-slide');
		// for (var i = 0; i < slide_this.length; i++) {
		// 	(function(i) {
	  //       setTimeout(function() {
	  //           slide_this.eq(i).addClass('animated fadeInUp');
	  //       }, 300);
	  //   })(i)
		// }

		apiready = function() {
			_config = _getPrefs('_config');
			//  console.log(JSON.stringify(_config))
			if(adName){
				_init_ad();
				ad = api.require(adName);
				banner('#ad');
			}
			if(api.pageParam['_name'] == 'fang'){
				$('.xiamian').hide();
			}

			if(_config.config.app == 1){
				$('.yinbi').removeClass('aui-hide');
				$('.lahei').removeClass('aui-hide');
				$('.asdasd').addClass('aui-hide');
			}
			$api.fixTabBar($api.dom('.dels'))
			_name = api.winName;
			if(api.winName == 'index_video'){
				_frameName = 'index_list';
			}

			api.parseTapmode();
			a = api.pageParam;
			if(a._name=='article'){
				$('.baocun').hide();
				$('.shoucang').hide();
			}else{
				shoucang_ajax();
			}
			//  console.log(JSON.stringify(a));

			if(_getPrefs('lahei'+a.uid)){
				$('.lahei .aui-ellipsis-1').text('解除拉黑')
			}
			// if(_getPrefs('yinbi'+a.id)){
			// 	$('.lahei .aui-ellipsis-1').text('已隐蔽')
			// }

			if(a.title){
				a.title = a.title.substring(0,50);

			}else{
				a.title = _config.config.yaoqing_title;
			}
			if(a.content){
				a.content = a.content.substring(0,200)
			}else{
				a.content = _config.config.yaoqing_content;
			}

			if(api.systemType == 'ios'){
				a.img = _i + 'logo.png';
			}else{
				a.img = _sx_gurl + '/public/style/image/logos.png';
			}

			a.video_url = a.url;
			a.url = _sx_gurl + 'index.php/index/m/'+(a._name=='article'?'a':'v')+'/id/'+a.id;

			//console.log(JSON.stringify(a));
			if(_getPrefs('_user')){
				if(a.uid && a.uid == _getPrefs('_user').id){
					$('.del').removeClass('aui-hide');
				}
			}
			// console.log(JSON.stringify(a));
		}
		function c(){
			if(a._t){
				api.closeFrame({
				    name: 't'
				});
			}
			api.closeFrame();
		}
		// 微信分享
		// type session（会话） timeline（朋友圈） favorite（收藏）
		function _weixin(type,data) {
			var wx = api.require('wxPlus');
			wx.shareWebpage({
				scene : type,
				title : a.title,
				description : a.content,
				thumb : a.img,
				contentUrl : a.url
			}, function(ret, err) {
				if (ret.status) {
				}
			});
		}
		// QQ分享
		// type 分享内容到好友或空间，取值范围：QZone、QFriend
		function _qq(type,data){
			var QQPlus = api.require('QQPlus');
			QQPlus.shareNews({
				url : a.url,
				title : a.title,
				description : a.content,
				imgUrl : a.img,
				type : type,
			}, function(ret, err) {
				if (ret.status) {
				}
			});
		}
		function _weibo(){
			var weibo = api.require('weiboPlus');
			weibo.isInstalled(
			    function(ret) {
			        if (ret.status) {
								weibo.shareWebPage({
									text: '',
									title: a.title,
									description: a.content,
									thumb:  a.img,
									contentUrl: a.url
								}, function(ret, err) {
									if (ret.status) {
											console.log('分享成功');
									}
								});
			        } else {
			            alert('未安装新浪微博客户端');
			        }
			    }
			);
		}
		// 复制
		function fuzhi(){
			var clipBoard = api.require('clipBoard');
			clipBoard.set({
				value : a.title + a.content + a.url
			}, function(ret, err) {
				if (ret) {
					api.execScript({
							name: _name,
							frameName:_frameName,
							script: '_msg("复制成功，快把链接分享给朋友们吧")'
					});
					c();
				}
			});
		}

		// 举报
		function jubao(){
			// if(!_getPrefs('_user')){
			// 	return _login();
			// }
			var b = ['低俗', '政治敏感','违法犯罪','广告营销','侮辱谩骂','未成年人不当行为','引人反感不适','其他'];
			api.actionSheet({
			    title: '请选择举报内容',
			    cancelTitle: '取消',
			    buttons: b
			}, function(ret, err) {
			    var index = ret.buttonIndex;
			    if(index == b.length){
			    	api.prompt({
					    buttons: ['确定', '取消'],
					    title:'描述举报理由（250字内）'
					}, function(ret, err) {
					    var index = ret.buttonIndex;
					    var text = ret.text;
					    if(index == 1){
					    	if(text){
					    		jubao_ajax(text)
					    	}else{
					    		_alert('内容不能为空')
					    	}
					    }
					});
			    }else if(index != b.length+1){
			    	jubao_ajax(b[index-1])
			    }
			});
		}
		// 举报提交
		function jubao_ajax(content){
			_loading()
			_ajax('member/jubao/_name/'+a._name,function(ret,err){
				_loadingCloes();
				if(ret){
					// api.execScript({
					// 		name:_name,
					// 		frameName: _frameName,
					// 		script: 'slideNext()'
					// });
					api.execScript({
							name:_name,
							frameName: _frameName,
							script: '_msg("举报成功")'
					});
					c();
				}else{
					_alert(JSON.stringify(err));
				}
			},{vid:a.id,content:content})
		}
		function sharedModule(){
			var sharedModule = api.require('shareAction');
			sharedModule.share({
			    text: a.title+" "+ a.url,
			    type: 'url',
			    path:a.url,
			    images:a.img,
			    thumbnail:a.img,
			});
		}
		function baocun(){

			if(!a.url){
				return _msg('视频地址错误，无法保存视频');
			}
			_loading('正在下载中')

			api.download({
			    url: _sx_qiniu + a.video_url,
			    savePath: 'fs://'+_file_name()+'.mp4',
			    report: true,
			    cache: true,
			    allowResume: true
			}, function(ret, err) {
					console.log(JSON.stringify(ret)+JSON.stringify(err))
			    if (ret) {
						if(ret.state == 1){
							api.saveMediaToAlbum({
							    path:ret.savePath,
							    groupName:'www_suxiangw_com'
							}, function(ret, err) {
								_loadingCloes();
						    if (ret && ret.status) {
									api.execScript({
							        name: _name,
											frameName:_frameName,
							        script: '_msg("保存成功")'
							    });
									c();
						   	//	_msg('保存成功');
						    } else {
							  _alert('保存失败');
						    }
							});
						}else if(ret.state == 2){
							_loadingCloes();
							_alert('下载失败');
						}else{
							console.log('下载进度：'+ret.percent);
						}
			    } else {
				  	_alert(err.msg);
						_loadingCloes();
			    }
			});

		}
		// 收藏
		function shoucang(){
			if(!_getPrefs('_user')){
				return _login();
			}
			if($('.shoucang').data('id')){
				return _msg('请稍候操作');
			}
			_loading('收藏中...');
			_ajax('member/shoucang_add',function(ret,err){
				_loadingCloes();
				if(ret){
					if(ret.ret){
						api.execScript({
								name: _name,
								frameName:_frameName,
								script: '_msg("'+ret.ret+'")'
						});
						c();
					}else{
						_msg(ret.err);
					}
				}
			},{vid:a.id})
		}
		// 显示隐藏收藏状态
		function shoucang_cls(a){
			var _this = $('.shoucang img');
			if(a){
			 // 已收藏
				_this.css('opacity','1');
				_this.attr('src','../i/share/shoucang_s.png');
				$('.shoucang').children('.aui-ellipsis-1').text('取消收藏');
			}else{
			 // 未收藏
			 _this.removeAttr('style');
			 _this.attr('src','../i/share/shoucang.png');
			 $('.shoucang').children('.aui-ellipsis-1').text('收藏');
			}
		}
		// 获取状态
		function shoucang_ajax(){
			if(!_getPrefs('_user')){
				return;
			}
			_ajax('member/shoucang_cls',function(ret,err){
				if(ret){
					$('.shoucang').removeAttr('data-id');
					// console.log(JSON.stringify(ret))
					if(ret.ret){
						shoucang_cls(1);
					}else{
						shoucang_cls(0);
					}
				}
			},{vid:api.pageParam['id']})
		}
		// 删除视频
		function del(){
			if(!a.uid){
				return _msg('非法操1');
			}
			if(a.uid != _getPrefs('_user').id){
				return _msg('非法操作2');
			}
			_loading('删除中。。。');
			api.confirm({
			    title: '确认好删除吗？',
			    msg: '删除视频后无法恢复！',
			    buttons: ['取消', '删除']
			}, function(ret, err) {
			    var index = ret.buttonIndex;
					if(index == 2){
						_ajax('member/del',function(ret,err){
							_loadingCloes();
							if(ret){
								if(ret.ret){
									api.execScript({
											name:_name,
											frameName: _frameName,
											script: '_msg("'+(ret.ret)+'")'
									});
									c();
								}else{
									_msg(ret.err)
								}

								// api.execScript({
								// 		name:_name,
								// 		frameName: _frameName,
								// 		script: 'slideNext()'
								// });
								// api.execScript({
								// 		name:_name,
								// 		frameName: _frameName,
								// 		script: '_msg("'+(ret.ret?ret.ret:ret.err)+'")'
								// });

							}else{
								_alert(JSON.stringify(err));
							}
						},{vid:a.id})
					}
			});
		}
		// 隐蔽
		function yinbi(){
			_setPrefs('yinbi'+a.id, a.id);
			api.execScript({
					name:_name,
					frameName: _frameName,
					script: 'dandel()'
			});
			c()
		}
		// 拉黑
		function lahei(){
			if(_getPrefs('lahei'+a.uid)){
				_removePrefs('lahei'+a.uid, a.uid);
				api.execScript({
						name:_name,
						frameName: _frameName,
						script: '_msg("已解除拉黑用户")'
				});
				c();
				return;
			}
			api.confirm({
					msg: 'TA将无法看到你在视频上的内容，确定要拉黑吗？',
					buttons: ['确定', '取消']
			}, function(ret, err){
					if( ret ){
						if(ret.buttonIndex == 1){
							_setPrefs('lahei'+a.uid, a.uid);
							api.execScript({
									name:_name,
									frameName: _frameName,
									script: 'slideNext()'
							});
							api.execScript({
									name:_name,
									frameName: _frameName,
									script: 'slideNext()'
							});
							api.execScript({
									name:_name,
									frameName: _frameName,
									script: '_msg("已被你加入黑名单")'
							});
							c();
						}
					}
			});
		}
	</script>
</html>
